#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:zhuyan
@file: param.py
@time: 2018/08/21
"""


class Params:

    def fun(self, num=None, name=None):
        print(name)
        print("num:%d" % num)

    def fun2(self, a, *values):
        """
        values是可变参数，可以输入0-n个，实际获取到的是一个元祖('a','b')
        :param a:
        :param values:
        :return:
        """
        print(type(values))
        print(values)
        if len(values) > 0:
            print(values[0])

    def fun3(self,a,**args):
        print(type(args))
        print(args)
        if len(args)>0:
            print(args["key"])


if __name__ == '__main__':
    p = Params()
    p.fun(2, "朱艳")
    p.fun(2)
    p.fun(name="zhu", num=3)

    p.fun2("test","a")
    p.fun2("test")
    p.fun2("test","a","b","c")

    p.fun3("test", key="c")
    p.fun3("test")
    p.fun3("test", l=1, key=2)